<template>
  <div class="home-container">
    <!-- 背景装饰元素 -->
    <div class="bg-decoration">
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
      <div class="floating-dots">
        <span v-for="i in 20" :key="i" class="dot" :style="{ animationDelay: i * 0.1 + 's' }"></span>
      </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <!-- Logo和标题区域 -->
      <div v-if="!showResults" class="header-section">
        <h1 class="main-title">
          <span class="title-highlight">🤖</span> 
          <span class="title-main">您好！我是您的</span>
          <span class="title-emphasis">智能生产排产助手</span>
          <!-- <span class="title-wave">👋</span> -->
        </h1>
        <p class="sub-title">
          <span class="feature-line">
            我具备强大的AI能力，能够为您提供：
          </span>
          <br />
          <div class="feature-tags">
            <span class="feature-tag">
              <span class="tag-icon">📊</span>
              <span class="tag-text">实时数据洞察</span>
            </span>
            <span class="feature-tag">
              <span class="tag-icon">📈</span>
              <span class="tag-text">智能预测分析</span>
            </span>
            <span class="feature-tag">
              <span class="tag-icon">📋</span>
              <span class="tag-text">历史趋势挖掘</span>
            </span>
            <span class="feature-tag">
              <span class="tag-icon">📚</span>
              <span class="tag-text">知识库查询</span>
            </span>
            <span class="feature-tag">
              <span class="tag-icon">🌱</span>
              <span class="tag-text">ESG可持续发展</span>
            </span>
          </div>
          <div class="invite-text">
            <span class="invite-main">💬 请描述您的需求，让我来为您解决生产难题</span>
            <span class="invite-sparkle">✨</span>
          </div>
        </p>
      </div>

      <!-- 输入框区域 -->
      <div class="input-section">
        <div class="input-container">
          <div class="input-header">
            <span class="input-title">🎯 描述您的需求</span>
            <span class="input-hint">Ctrl + Enter 快速提交</span>
          </div>
          <el-input
            v-model="userInput"
            type="textarea"
            :rows="4"
            placeholder="例如：我想了解本月的生产效率情况，分析设备利用率趋势，或者需要生成ESG可持续发展报告..."
            class="smart-input"
            @keydown.ctrl.enter="handleSubmit"
          />
          <div class="input-actions">
            <div class="quick-suggestions">
              <span class="suggestion-label">💡 快速开始：</span>
              <el-button 
                size="small" 
                text 
                class="suggestion-btn"
                @click="userInput = '查询当月生产数据概览'"
              >
                查询生产概览
              </el-button>
              <el-button 
                size="small" 
                text 
                class="suggestion-btn"
                @click="userInput = '分析设备利用率趋势'"
              >
                设备分析
              </el-button>
              <el-button 
                size="small" 
                text 
                class="suggestion-btn"
                @click="userInput = '生成ESG可持续发展报告'"
              >
                ESG报告
              </el-button>
            </div>
            <el-button 
              type="primary" 
              class="submit-btn"
              :loading="isProcessing"
              @click="handleSubmit"
              :disabled="!userInput.trim()"
              size="large"
            >
              <el-icon><Search /></el-icon>
              {{ isProcessing ? '🔄 AI正在思考...' : '🚀 开始分析' }}
            </el-button>
          </div>
        </div>
      </div>

    </div>

    <!-- 智能分析结果区域 - 位于输入框下方 -->
    <div v-if="showResults" class="analysis-results-section">
      <div class="analysis-container">
        <!-- 分析状态头部 -->
        <div class="analysis-header">
          <div class="analysis-title">
            <el-icon class="analysis-icon"><DataAnalysis /></el-icon>
            <span>AI智能分析结果</span>
          </div>
          <div class="analysis-actions">
            <div class="analysis-status">
              <el-tag v-if="isProcessing" type="warning" class="status-tag">
                <el-icon class="rotating"><Loading /></el-icon>
                分析中...
              </el-tag>
              <el-tag v-else type="success" class="status-tag">
                <el-icon><Select /></el-icon>
                分析完成
              </el-tag>
            </div>
            <el-button 
              type="danger" 
              size="small" 
              text 
              class="close-btn"
              @click="closeAnalysis"
              :disabled="isProcessing"
            >
              <el-icon><Close /></el-icon>
            </el-button>
          </div>
        </div>

        <!-- 分析内容区域 -->
        <div class="analysis-content">
          <div v-if="isProcessing" class="analysis-loading">
            <div class="loading-visualization">
              <div class="pulse-ring"></div>
              <div class="pulse-ring"></div>
              <div class="pulse-ring"></div>
              <el-icon class="brain-icon"><Platform /></el-icon>
            </div>
            <div class="loading-steps">
              <div class="step" :class="{ active: currentStep >= 1 }">
                <el-icon><DocumentCopy /></el-icon>
                <span>数据解析</span>
              </div>
              <div class="step" :class="{ active: currentStep >= 2 }">
                <el-icon><MagicStick /></el-icon>
                <span>AI分析</span>
              </div>
              <div class="step" :class="{ active: currentStep >= 3 }">
                <el-icon><PieChart /></el-icon>
                <span>生成图表</span>
              </div>
              <div class="step" :class="{ active: currentStep >= 4 }">
                <el-icon><Document /></el-icon>
                <span>生成报告</span>
              </div>
            </div>
            <p class="loading-message">{{ loadingMessage }}</p>
          </div>

          <div v-else class="analysis-results">
            <!-- 结果概要 -->
            <div class="result-summary">
              <div class="summary-card">
                <el-icon class="summary-icon"><SuccessFilled /></el-icon>
                <div class="summary-content">
                  <h4>分析完成</h4>
                  <p>{{ analysisResult }}</p>
                </div>
              </div>
            </div>

            <!-- 结果展示选项卡 -->
            <el-tabs v-model="activeResultTab" type="border-card" class="result-tabs">
              <el-tab-pane label="📊 图表分析" name="chart">
                <div class="chart-panel">
                  <div class="chart-container">
                    <el-card class="chart-card" shadow="never">
                      <template #header>
                        <div class="chart-header">
                          <span class="chart-title">
                            <el-icon><DataAnalysis /></el-icon>
                            数据可视化分析
                          </span>
                          <div class="chart-actions">
                            <el-button size="small" type="primary" text>
                              <el-icon><Download /></el-icon>
                              导出图表
                            </el-button>
                            <el-button size="small" type="primary" text>
                              <el-icon><FullScreen /></el-icon>
                              全屏查看
                            </el-button>
                          </div>
                        </div>
                      </template>
                      <div class="chart-content">
                        <!-- 模拟ECharts图表 -->
                        <div class="demo-chart">
                          <div class="chart-area">
                            <div class="chart-bars">
                              <div 
                                v-for="(item, index) in chartData" 
                                :key="index"
                                class="chart-bar"
                                :style="{ 
                                  height: item.value + '%',
                                  backgroundColor: `hsl(${260 + index * 20}, 60%, 65%)`,
                                  animationDelay: index * 0.2 + 's'
                                }"
                              >
                                <div class="bar-value">{{ item.value }}%</div>
                                <div class="bar-label">{{ item.label }}</div>
                              </div>
                            </div>
                          </div>
                          <div class="chart-legend">
                            <span class="legend-item">
                              <div class="legend-color" style="background: #714B67"></div>
                              生产效率
                            </span>
                            <span class="legend-item">
                              <div class="legend-color" style="background: #922575"></div>
                              设备利用率
                            </span>
                            <span class="legend-item">
                              <div class="legend-color" style="background: #a64ac9"></div>
                              质量指标
                            </span>
                          </div>
                        </div>
                      </div>
                    </el-card>
                  </div>
                </div>
              </el-tab-pane>
              
              <el-tab-pane label="📝 文字报告" name="report">
                <div class="report-panel">
                  <el-card class="report-card" shadow="never">
                    <template #header>
                      <div class="report-header">
                        <span class="report-title">
                          <el-icon><Document /></el-icon>
                          智能分析报告
                        </span>
                        <div class="report-actions">
                          <el-button size="small" type="primary" text>
                            <el-icon><Download /></el-icon>
                            导出报告
                          </el-button>
                          <el-button size="small" type="primary" text>
                            <el-icon><Share /></el-icon>
                            分享报告
                          </el-button>
                        </div>
                      </div>
                    </template>
                    <div class="report-content">
                      <div class="report-section">
                        <h4>📋 分析概要</h4>
                        <p>基于您提供的需求"{{ userInput }}"，AI智能分析系统已完成深度数据挖掘和趋势分析。</p>
                      </div>
                      
                      <div class="report-section">
                        <h4>📈 关键发现</h4>
                        <ul class="findings-list">
                          <li>生产效率较上月提升15.8%，设备运行状态良好</li>
                          <li>当前产能利用率达到87%，接近最优配置水平</li>
                          <li>质量指标稳定在98.5%以上，符合行业标准</li>
                          <li>建议在下午2-4点增加设备维护窗口期</li>
                        </ul>
                      </div>

                      <div class="report-section">
                        <h4>💡 智能建议</h4>
                        <div class="suggestions">
                          <div class="suggestion-item">
                            <el-icon class="suggestion-icon"><Promotion /></el-icon>
                            <div class="suggestion-content">
                              <strong>优化建议：</strong>
                              <p>根据历史数据分析，建议在工作日下午调整生产节奏，可进一步提升整体效率约8-12%。</p>
                            </div>
                          </div>
                          <div class="suggestion-item">
                            <el-icon class="suggestion-icon"><Warning /></el-icon>
                            <div class="suggestion-content">
                              <strong>风险提醒：</strong>
                              <p>设备A-03近期运行温度略高，建议安排预防性维护，避免潜在停机风险。</p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </el-card>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部状态区域 -->
    <div v-if="!showResults" class="status-section">
      <el-row :gutter="24">
        <!-- 系统状态 -->
        <el-col :span="12">
          <div class="status-card modern-card">
            <div class="card-header">
              <div class="header-icon">
                <el-icon><Monitor /></el-icon>
              </div>
              <div class="header-content">
                <h4 class="header-title">🖥️ 系统实时状态</h4>
                <p class="header-subtitle">System Real-time Status</p>
              </div>
            </div>
            <div class="status-content">
              <div class="status-item">
                <div class="status-indicator">
                  <div class="indicator-dot" :class="{ online: systemStatus.isOnline }"></div>
                  <span class="status-label">系统状态</span>
                </div>
                <el-tag :type="systemStatus.isOnline ? 'success' : 'danger'" class="status-tag">
                  {{ systemStatus.isOnline ? '🟢 在线运行' : '🔴 离线' }}
                </el-tag>
              </div>
              <div class="status-item">
                <div class="status-info">
                  <span class="status-label">📋 当前工单</span>
                  <span class="status-value">{{ systemStatus.currentOrders }} <small>个</small></span>
                </div>
              </div>
              <div class="status-item">
                <div class="status-info">
                  <span class="status-label">⚙️ 设备利用率</span>
                  <span class="status-value">{{ systemStatus.equipmentUtilization }} <small>%</small></span>
                </div>
                <div class="progress-bar">
                  <div class="progress-fill" :style="{ width: systemStatus.equipmentUtilization + '%' }"></div>
                </div>
              </div>
              <div class="status-item">
                <div class="status-info">
                  <span class="status-label">📦 今日产量</span>
                  <span class="status-value">{{ systemStatus.todayProduction }} <small>件</small></span>
                </div>
              </div>
            </div>
          </div>
        </el-col>

        <!-- 最近排产记录 -->
        <el-col :span="12">
          <div class="status-card modern-card">
            <div class="card-header">
              <div class="header-icon">
                <el-icon><Document /></el-icon>
              </div>
              <div class="header-content">
                <h4 class="header-title">📅 最近排产计划</h4>
                <p class="header-subtitle">Recent Scheduling Plans</p>
              </div>
            </div>
            <div class="records-content">
              <div 
                v-for="(record, index) in recentRecords" 
                :key="index"
                class="record-item"
                :style="{ animationDelay: index * 0.1 + 's' }"
              >
                <div class="record-header">
                  <div class="record-icon">
                    <span v-if="record.status === '成功'">✅</span>
                    <span v-else-if="record.status === '处理中'">⏳</span>
                    <span v-else>📄</span>
                  </div>
                  <div class="record-main">
                    <span class="record-title">{{ record.title }}</span>
                    <el-tag 
                      :type="record.status === '成功' ? 'success' : record.status === '处理中' ? 'warning' : 'info'" 
                      size="small"
                      class="record-status"
                    >
                      {{ record.status }}
                    </el-tag>
                  </div>
                </div>
                <div class="record-meta">
                  <span class="record-time">🕐 {{ record.time }}</span>
                  <span class="record-orders">📊 {{ record.orderCount }} 个工单</span>
                </div>
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { 
  Search, Loading, Monitor, Document, DataAnalysis, Select, 
  Platform, DocumentCopy, MagicStick, PieChart, SuccessFilled,
  Download, FullScreen, Share, Promotion, Warning, Close
} from '@element-plus/icons-vue'

// 响应式数据
const userInput = ref('')
const isProcessing = ref(false)
const showResults = ref(false)
const analysisResult = ref('')

// 分析结果相关
const activeResultTab = ref('chart')
const currentStep = ref(0)
const loadingMessage = ref('')

// 模拟图表数据
const chartData = ref([
  { label: '设备A', value: 85 },
  { label: '设备B', value: 92 },
  { label: '设备C', value: 78 },
  { label: '设备D', value: 95 },
  { label: '设备E', value: 88 }
])

// 系统状态
const systemStatus = reactive({
  isOnline: true,
  currentOrders: 156,
  equipmentUtilization: 87,
  todayProduction: 2340
})

// 最近排产记录
const recentRecords = ref([
  {
    title: '汽车零部件生产排程',
    status: '成功',
    time: '2024-01-15 14:30',
    orderCount: 45
  },
  {
    title: '电子产品装配排程',
    status: '成功', 
    time: '2024-01-15 11:20',
    orderCount: 32
  },
  {
    title: '机械加工排程优化',
    status: '处理中',
    time: '2024-01-15 09:15',
    orderCount: 28
  },
  {
    title: '包装车间排程调整',
    status: '成功',
    time: '2024-01-14 16:45',
    orderCount: 67
  }
])

// 模拟分析步骤
const simulateAnalysisSteps = () => {
  const steps = [
    { step: 1, message: '正在解析您的需求...' },
    { step: 2, message: '正在进行AI智能分析...' },
    { step: 3, message: '正在生成数据图表...' },
    { step: 4, message: '正在生成分析报告...' }
  ]
  
  let stepIndex = 0
  const interval = setInterval(() => {
    if (stepIndex < steps.length) {
      currentStep.value = steps[stepIndex].step
      loadingMessage.value = steps[stepIndex].message
      stepIndex++
    } else {
      clearInterval(interval)
    }
  }, 500)
  
  return interval
}

// 处理提交
const handleSubmit = async () => {
  if (!userInput.value.trim()) {
    ElMessage.warning('请输入您的需求')
    return
  }

  isProcessing.value = true
  showResults.value = true
  currentStep.value = 0
  loadingMessage.value = '正在启动AI分析引擎...'

  try {
    // 启动步骤模拟
    const interval = simulateAnalysisSteps()
    
    // 模拟API调用
    await new Promise(resolve => setTimeout(resolve, 3000))
    
    clearInterval(interval)
    analysisResult.value = `基于您的需求"${userInput.value}"，AI智能分析系统已完成深度数据挖掘，为您生成了详细的分析报告和可视化图表。`
    ElMessage.success('🎉 AI分析完成！为您生成了专业的分析报告')
  } catch (error) {
    ElMessage.error('处理失败，请重试')
  } finally {
    isProcessing.value = false
  }
}

// 生成随机图表数据
const generateRandomChartData = () => {
  chartData.value = chartData.value.map(item => ({
    ...item,
    value: Math.floor(Math.random() * 40) + 60
  }))
}

// 关闭分析结果
const closeAnalysis = () => {
  showResults.value = false
  isProcessing.value = false
  ElMessage.info('已关闭分析结果')
}

onMounted(() => {
  // 定期更新图表数据，模拟实时效果
  setInterval(generateRandomChartData, 5000)
})
</script>

<style scoped>
.home-container {
  min-height: 100vh;
  /* background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); */
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 背景装饰元素 - 简约版 */
.bg-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.floating-shape {
  position: absolute;
  opacity: 0.05;
  border-radius: 50%;
  animation: subtleFloat 8s ease-in-out infinite;
}

.shape-1 {
  width: 120px;
  height: 120px;
  background: linear-gradient(45deg, #714B67, #922575);
  top: 15%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 80px;
  height: 80px;
  background: linear-gradient(45deg, #922575, #714B67);
  top: 60%;
  right: 15%;
  animation-delay: 3s;
}

.shape-3 {
  width: 60px;
  height: 60px;
  background: linear-gradient(45deg, #f1edf0, #714B67);
  bottom: 25%;
  left: 20%;
  animation-delay: 6s;
}

@keyframes subtleFloat {
  0%, 100% { transform: translateY(0px) scale(1); opacity: 0.05; }
  50% { transform: translateY(-15px) scale(1.1); opacity: 0.08; }
}

.floating-dots {
  position: absolute;
  width: 100%;
  height: 100%;
}

.dot {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(113, 75, 103, 0.2);
  border-radius: 50%;
  animation: gentleTwinkle 4s ease-in-out infinite;
}

.dot:nth-child(odd) {
  top: 25%;
  left: 35%;
}

.dot:nth-child(even) {
  top: 65%;
  right: 30%;
}

@keyframes gentleTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.header-section {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 50px;
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-container {
  margin-bottom: 40px;
}

.logo-wrapper {
  position: relative;
  display: inline-block;
  animation: logoFloat 3s ease-in-out infinite;
}

.logo {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 8px 16px rgba(255, 255, 255, 0.3));
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.1) rotate(5deg);
}

.logo-glow {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(116, 75, 103, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 0.3; }
}

.main-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: #714B67;
  margin: 0 0 30px 0;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  text-shadow: 0 2px 4px rgba(113, 75, 103, 0.1);
  line-height: 1.2;
}

.title-main {
  display: inline-block;
  color: #52374b;
}

.title-emphasis {
  display: inline-block;
  background: linear-gradient(45deg, #714B67, #922575);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  animation: subtleShimmer 3s ease-in-out infinite;
}

@keyframes subtleShimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.title-highlight {
  display: inline-block;
  animation: gentleBounce 3s ease-in-out infinite;
  font-size: 1.1em;
}

.title-wave {
  display: inline-block;
  animation: subtleWave 2s ease-in-out infinite;
  font-size: 1.05em;
}

@keyframes gentleBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  60% { transform: translateY(-2px); }
}

@keyframes subtleWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(10deg); }
  75% { transform: rotate(-5deg); }
}

.sub-title {
  font-size: 1.1rem;
  color: #666;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.feature-line {
  display: block;
  margin-bottom: 20px;
  font-weight: 500;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 25px 0;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(113, 75, 103, 0.2);
  border-radius: 15px;
  padding: 8px 14px;
  font-weight: 500;
  color: #714B67;
  transition: all 0.3s ease;
  animation: slideInUp 0.6s ease-out;
  box-shadow: 0 2px 8px rgba(113, 75, 103, 0.1);
}

.feature-tag:hover {
  transform: translateY(-2px);
  background: #f1edf0;
  border-color: #714B67;
  box-shadow: 0 4px 12px rgba(113, 75, 103, 0.2);
}

.tag-icon {
  font-size: 1.1em;
}

.invite-text {
  margin-top: 30px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.invite-sparkle {
  animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3) rotate(180deg); }
}

.input-section {
  margin-bottom: 50px;
  animation: slideInUp 1s ease-out 0.3s both;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-container {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.input-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.input-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2d3436;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-hint {
  font-size: 0.9rem;
  color: #636e72;
  background: rgba(99, 110, 114, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
}

:deep(.smart-input .el-textarea__inner) {
  border: 2px solid rgba(116, 75, 103, 0.2);
  box-shadow: none;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

:deep(.smart-input .el-textarea__inner:focus) {
  border-color: #714B67;
  box-shadow: 0 0 0 3px rgba(113, 75, 103, 0.1);
  background: white;
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(116, 75, 103, 0.1);
}

.quick-suggestions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.suggestion-label {
  font-weight: 600;
  color: #2d3436;
  font-size: 0.9rem;
}

.suggestion-btn {
  background: rgba(116, 75, 103, 0.1);
  color: #714B67;
  border: 1px solid rgba(116, 75, 103, 0.2);
  border-radius: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.suggestion-btn:hover {
  background: #714B67;
  color: white;
  transform: translateY(-2px);
}

.submit-btn {
  background: linear-gradient(45deg, #714B67, #a64ac9);
  border: none;
  padding: 15px 30px;
  font-weight: 700;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(113, 75, 103, 0.3);
  transition: all 0.3s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(113, 75, 103, 0.4);
  background: linear-gradient(45deg, #5a3a52, #922575);
}

/* ========== 分析结果区域样式 ========== */
.analysis-results-section {
  margin: 40px auto;
  max-width: 1200px;
  animation: slideInUp 0.8s ease-out;
}

.analysis-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(113, 75, 103, 0.15);
  border: 1px solid rgba(113, 75, 103, 0.1);
  overflow: hidden;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(45deg, #714B67, #922575);
  color: white;
}

.analysis-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 600;
}

.analysis-icon {
  font-size: 1.5rem;
}

.analysis-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.analysis-status {
  display: flex;
  align-items: center;
}

.status-tag {
  border: none;
  font-weight: 500;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px;
  min-height: 32px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.close-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  transform: scale(1.05);
}

.close-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rotating {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.analysis-content {
  padding: 30px;
}

/* 加载状态样式 */
.analysis-loading {
  text-align: center;
  padding: 40px 0;
}

.loading-visualization {
  position: relative;
  display: inline-block;
  margin-bottom: 30px;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  border: 2px solid #714B67;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRing 2s ease-out infinite;
}

.pulse-ring:nth-child(2) {
  animation-delay: 0.5s;
}

.pulse-ring:nth-child(3) {
  animation-delay: 1s;
}

@keyframes pulseRing {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

.brain-icon {
  font-size: 2.5rem;
  color: #714B67;
  z-index: 10;
  position: relative;
}

.loading-steps {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 15px;
  border-radius: 12px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  min-width: 100px;
}

.step.active {
  background: #f1edf0;
  border-color: #714B67;
  color: #714B67;
  transform: scale(1.05);
}

.step .el-icon {
  font-size: 1.5rem;
}

.step span {
  font-size: 0.9rem;
  font-weight: 500;
}

.loading-message {
  font-size: 1.1rem;
  color: #714B67;
  font-weight: 500;
  margin-top: 15px;
}

/* 结果展示样式 */
.result-summary {
  margin-bottom: 25px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: linear-gradient(45deg, #f1edf0, #ffffff);
  border-radius: 12px;
  border-left: 4px solid #714B67;
  box-shadow: 0 2px 8px rgba(113, 75, 103, 0.1);
}

.summary-icon {
  font-size: 2rem;
  color: #22c55e;
}

.summary-content h4 {
  margin: 0 0 8px 0;
  color: #714B67;
  font-size: 1.2rem;
  font-weight: 600;
}

.summary-content p {
  margin: 0;
  color: #666;
  line-height: 1.6;
}

.result-tabs {
  border: 1px solid rgba(113, 75, 103, 0.2);
  border-radius: 12px;
  overflow: hidden;
}

:deep(.result-tabs .el-tabs__header) {
  background: #f8f9fa;
  margin: 0;
}

:deep(.result-tabs .el-tabs__active-bar) {
  background: #714B67;
}

:deep(.result-tabs .el-tabs__item.is-active) {
  color: #714B67;
  font-weight: 600;
}

/* 图表面板样式 */
.chart-panel {
  padding: 20px;
}

.chart-container {
  background: white;
  border-radius: 12px;
}

.chart-card {
  border: none;
  box-shadow: 0 4px 12px rgba(113, 75, 103, 0.1);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #714B67;
  font-size: 1.1rem;
}

.chart-actions {
  display: flex;
  gap: 10px;
}

.demo-chart {
  padding: 20px 0;
}

.chart-area {
  margin-bottom: 30px;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 20px;
  height: 280px;
  padding: 0 20px;
}

.chart-bar {
  position: relative;
  width: 50px;
  border-radius: 6px 6px 0 0;
  transition: all 0.3s ease;
  animation: barGrowUp 1s ease-out;
  cursor: pointer;
}

.chart-bar:hover {
  transform: scaleY(1.05);
  filter: brightness(1.1);
}

@keyframes barGrowUp {
  from { height: 0; }
  to { height: 100%; }
}

.bar-value {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  font-weight: 600;
  color: #714B67;
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bar-label {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #666;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

/* 报告面板样式 */
.report-panel {
  padding: 20px;
}

.report-card {
  border: none;
  box-shadow: 0 4px 12px rgba(113, 75, 103, 0.1);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #714B67;
  font-size: 1.1rem;
}

.report-actions {
  display: flex;
  gap: 10px;
}

.report-content {
  line-height: 1.8;
}

.report-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.report-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.report-section h4 {
  color: #714B67;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-section p {
  color: #666;
  margin-bottom: 15px;
}

.findings-list {
  margin: 0;
  padding-left: 20px;
}

.findings-list li {
  color: #666;
  margin-bottom: 10px;
  line-height: 1.6;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.suggestion-item {
  display: flex;
  gap: 12px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #714B67;
}

.suggestion-icon {
  font-size: 1.3rem;
  color: #714B67;
  margin-top: 2px;
}

.suggestion-content {
  flex: 1;
}

.suggestion-content strong {
  color: #714B67;
  font-weight: 600;
}

.suggestion-content p {
  margin: 5px 0 0 0;
  color: #666;
}

/* ========== 状态区域样式 ========== */

.status-section {
  margin-top: auto;
  padding-top: 30px;
  animation: slideInUp 1s ease-out 0.9s both;
}

.modern-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 32px rgba(113, 75, 103, 0.12);
  border: 1px solid rgba(113, 75, 103, 0.1);
  transition: all 0.3s ease;
  animation: cardSlideIn 0.8s ease-out;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modern-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(113, 75, 103, 0.18);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(113, 75, 103, 0.1);
}

.header-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(45deg, #714B67, #922575);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #714B67;
  margin: 0;
}

.header-subtitle {
  font-size: 0.85rem;
  color: #666;
  margin: 5px 0 0 0;
  font-weight: 400;
}

.status-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(113, 75, 103, 0.05);
  border-radius: 10px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.status-item:hover {
  background: rgba(113, 75, 103, 0.08);
  transform: translateX(3px);
  border-color: rgba(113, 75, 103, 0.1);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ddd;
  transition: all 0.3s ease;
}

.indicator-dot.online {
  background: linear-gradient(45deg, #22c55e, #16a34a);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.status-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-label {
  color: #666;
  font-weight: 500;
  font-size: 0.9rem;
}

.status-value {
  color: #714B67;
  font-weight: 600;
  font-size: 1.1rem;
}

.status-value small {
  font-size: 0.8rem;
  color: #666;
}

.progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(113, 75, 103, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #714B67, #922575);
  border-radius: 3px;
  transition: width 1s ease-out;
  animation: progressGlow 3s ease-in-out infinite;
}

@keyframes progressGlow {
  0%, 100% { box-shadow: 0 0 3px rgba(113, 75, 103, 0.3); }
  50% { box-shadow: 0 0 8px rgba(113, 75, 103, 0.6); }
}

.records-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.record-item {
  padding: 15px;
  background: rgba(113, 75, 103, 0.05);
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  animation: recordFadeIn 0.6s ease-out;
  border: 1px solid transparent;
}

@keyframes recordFadeIn {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.record-item:hover {
  background: rgba(113, 75, 103, 0.08);
  border-left-color: #714B67;
  border-color: rgba(113, 75, 103, 0.1);
  transform: translateX(3px);
}

.record-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.record-icon {
  font-size: 1.1rem;
}

.record-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}

.record-title {
  font-weight: 500;
  color: #714B67;
  font-size: 0.95rem;
}

.record-status {
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.8rem;
}

.record-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #666;
  margin-left: 28px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .main-title {
    font-size: 2.2rem;
  }
  
  .sub-title {
    font-size: 1rem;
  }
  
  .feature-tags {
    flex-direction: column;
    align-items: center;
  }
  
  .input-container {
    margin: 0 10px;
    padding: 20px;
  }
  
  .input-actions {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .quick-suggestions {
    justify-content: center;
  }
  
  .status-section .el-col {
    margin-bottom: 20px;
  }
  
  .card-header {
    flex-direction: column;
    text-align: center;
  }
  
  .chart-bars {
    gap: 12px;
  }
  
  .chart-bar {
    width: 35px;
  }
  
  .analysis-container {
    margin: 0 10px;
  }
  
  .analysis-header {
    padding: 15px 20px;
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .analysis-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .analysis-content {
    padding: 20px;
  }
  
  .loading-steps {
    gap: 15px;
  }
  
  .step {
    min-width: 80px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .main-title {
    font-size: 1.8rem;
  }
  
  .feature-tag {
    width: 100%;
    justify-content: center;
  }
  
  .input-header {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  .chart-bars {
    gap: 8px;
    padding: 0 10px;
  }
  
  .chart-bar {
    width: 25px;
  }
  
  .loading-steps {
    flex-direction: column;
    align-items: center;
  }
  
  .chart-legend {
    flex-direction: column;
    gap: 10px;
  }
}
</style>